﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Apple.ReplayKit.ReplayKit
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System.Runtime.CompilerServices;
using UnityEngine.Bindings;
using UnityEngine.Internal;

#nullable disable
namespace UnityEngine.Apple.ReplayKit
{
  /// <summary>
  ///   <para>ReplayKit is only available on certain iPhone, iPad and iPod Touch devices running iOS 9.0 or later.</para>
  /// </summary>
  [NativeHeader("PlatformDependent/iPhonePlayer/IOSScriptBindings.h")]
  public static class ReplayKit
  {
    /// <summary>
    ///   <para>A boolean that indicates whether the ReplayKit API is available (where True means available). (Read Only)</para>
    /// </summary>
    public static extern bool APIAvailable { [NativeConditional("PLATFORM_IOS || PLATFORM_TVOS"), FreeFunction("UnityReplayKitAPIAvailable"), MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///         <para>A Boolean that indicates whether ReplayKit broadcasting API is available (true means available) (Read Only).
    /// Check the value of this property before making ReplayKit broadcasting API calls. On iOS versions prior to iOS 10, this property will have a value of false.</para>
    ///       </summary>
    public static extern bool broadcastingAPIAvailable { [FreeFunction("UnityReplayKitBroadcastingAPIAvailable"), NativeConditional("PLATFORM_IOS || PLATFORM_TVOS"), MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>A boolean value that indicates that a new recording is available for preview (where True means available). (Read Only)</para>
    /// </summary>
    public static extern bool recordingAvailable { [FreeFunction("UnityReplayKitRecordingAvailable"), NativeConditional("PLATFORM_IOS || PLATFORM_TVOS"), MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>A boolean that indicates whether ReplayKit is making a recording (where True means a recording is in progress). (Read Only)</para>
    /// </summary>
    public static extern bool isRecording { [FreeFunction("UnityReplayKitIsRecording"), NativeConditional("PLATFORM_IOS || PLATFORM_TVOS"), MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>Boolean property that indicates whether a broadcast is currently in progress (Read Only).</para>
    /// </summary>
    public static extern bool isBroadcasting { [NativeConditional("PLATFORM_IOS || PLATFORM_TVOS"), FreeFunction("UnityReplayKitIsBroadcasting"), MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>Boolean property that indicates whether a broadcast is currently paused (Read Only).</para>
    /// </summary>
    public static extern bool isBroadcastingPaused { [FreeFunction("UnityReplayKitIsBroadcastingPaused"), NativeConditional("PLATFORM_IOS || PLATFORM_TVOS"), MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>A boolean that indicates whether ReplayKit is currently displaying a preview controller. (Read Only)</para>
    /// </summary>
    public static extern bool isPreviewControllerActive { [NativeConditional("PLATFORM_IOS || PLATFORM_TVOS"), FreeFunction("UnityReplayKitIsPreviewControllerActive"), MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>Camera enabled status. True, if camera enabled; false otherwise.</para>
    /// </summary>
    public static extern bool cameraEnabled { [NativeConditional("PLATFORM_IOS"), FreeFunction("UnityReplayKitIsCameraEnabled"), MethodImpl(MethodImplOptions.InternalCall)] get; [FreeFunction("UnityReplayKitSetCameraEnabled"), NativeConditional("PLATFORM_IOS"), MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Microphone enabled status. True, if microphone enabled; false otherwise.</para>
    /// </summary>
    public static extern bool microphoneEnabled { [FreeFunction("UnityReplayKitIsMicrophoneEnabled"), NativeConditional("PLATFORM_IOS"), MethodImpl(MethodImplOptions.InternalCall)] get; [FreeFunction("UnityReplayKitSetMicrophoneEnabled"), NativeConditional("PLATFORM_IOS"), MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>A string property that contains an URL used to redirect the user to an on-going or completed broadcast (Read Only).</para>
    /// </summary>
    public static extern string broadcastURL { [FreeFunction("UnityReplayKitGetBroadcastURL"), NativeConditional("PLATFORM_IOS || PLATFORM_TVOS"), MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>A string value of the last error incurred by the ReplayKit: Either 'Failed to get Screen Recorder' or 'No recording available'. (Read Only)</para>
    /// </summary>
    public static extern string lastError { [FreeFunction("UnityReplayKitLastError"), NativeConditional("PLATFORM_IOS || PLATFORM_TVOS"), MethodImpl(MethodImplOptions.InternalCall)] get; }

    [NativeConditional("PLATFORM_IOS || PLATFORM_TVOS")]
    [FreeFunction("ReplayKitScripting::StartRecording")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern bool StartRecordingImpl(bool enableMicrophone, bool enableCamera);

    [FreeFunction("ReplayKitScripting::StartBroadcasting")]
    [NativeConditional("PLATFORM_IOS || PLATFORM_TVOS")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void StartBroadcastingImpl(
      UnityEngine.Apple.ReplayKit.ReplayKit.BroadcastStatusCallback callback,
      bool enableMicrophone,
      bool enableCamera);

    /// <summary>
    ///   <para>Start a new recording.</para>
    /// </summary>
    /// <param name="enableMicrophone">Enable or disable the microphone while making a recording. Enabling the microphone allows you to include user commentary while recording. The default value is false.</param>
    /// <param name="enableCamera">Enable or disable the camera while making a recording. Enabling camera allows you to include user camera footage while recording. The default value is false. To actually include camera footage in your recording, you also have to call ShowCameraPreviewAt as well to position the preview view.</param>
    /// <returns>
    ///   <para>A boolean value of True if recording started successfully or False if an error occurred.</para>
    /// </returns>
    public static bool StartRecording([DefaultValue("false")] bool enableMicrophone, [DefaultValue("false")] bool enableCamera)
    {
      return UnityEngine.Apple.ReplayKit.ReplayKit.StartRecordingImpl(enableMicrophone, enableCamera);
    }

    public static bool StartRecording(bool enableMicrophone)
    {
      return UnityEngine.Apple.ReplayKit.ReplayKit.StartRecording(enableMicrophone, false);
    }

    public static bool StartRecording() => UnityEngine.Apple.ReplayKit.ReplayKit.StartRecording(false, false);

    public static void StartBroadcasting(
      UnityEngine.Apple.ReplayKit.ReplayKit.BroadcastStatusCallback callback,
      [DefaultValue("false")] bool enableMicrophone,
      [DefaultValue("false")] bool enableCamera)
    {
      UnityEngine.Apple.ReplayKit.ReplayKit.StartBroadcastingImpl(callback, enableMicrophone, enableCamera);
    }

    public static void StartBroadcasting(
      UnityEngine.Apple.ReplayKit.ReplayKit.BroadcastStatusCallback callback,
      bool enableMicrophone)
    {
      UnityEngine.Apple.ReplayKit.ReplayKit.StartBroadcasting(callback, enableMicrophone, false);
    }

    public static void StartBroadcasting(UnityEngine.Apple.ReplayKit.ReplayKit.BroadcastStatusCallback callback)
    {
      UnityEngine.Apple.ReplayKit.ReplayKit.StartBroadcasting(callback, false, false);
    }

    /// <summary>
    ///   <para>Stop the current recording.</para>
    /// </summary>
    /// <returns>
    ///   <para>A boolean value of True if recording stopped successfully or False if an error occurred.</para>
    /// </returns>
    [NativeConditional("PLATFORM_IOS || PLATFORM_TVOS")]
    [FreeFunction("UnityReplayKitStopRecording")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern bool StopRecording();

    /// <summary>
    ///         <para>Stops current broadcast.
    /// Will terminate currently on-going broadcast. If no broadcast is in progress, does nothing.</para>
    ///       </summary>
    [FreeFunction("UnityReplayKitStopBroadcasting")]
    [NativeConditional("PLATFORM_IOS || PLATFORM_TVOS")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern void StopBroadcasting();

    /// <summary>
    ///         <para>Pauses current broadcast.
    /// Will pause currently on-going broadcast. If no broadcast is in progress, does nothing.</para>
    ///       </summary>
    [FreeFunction("UnityReplayKitPauseBroadcasting")]
    [NativeConditional("PLATFORM_IOS || PLATFORM_TVOS")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern void PauseBroadcasting();

    /// <summary>
    ///         <para>Resumes current broadcast.
    /// Will resume currently on-going broadcast. If no broadcast is in progress, does nothing.</para>
    ///       </summary>
    [FreeFunction("UnityReplayKitResumeBroadcasting")]
    [NativeConditional("PLATFORM_IOS || PLATFORM_TVOS")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern void ResumeBroadcasting();

    /// <summary>
    ///   <para>Preview the current recording</para>
    /// </summary>
    /// <returns>
    ///   <para>A boolean value of True if the video preview window opened successfully or False if an error occurred.</para>
    /// </returns>
    [NativeConditional("PLATFORM_IOS || PLATFORM_TVOS")]
    [FreeFunction("UnityReplayKitPreview")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern bool Preview();

    /// <summary>
    ///   <para>Discard the current recording.</para>
    /// </summary>
    /// <returns>
    ///   <para>A boolean value of True if the recording was discarded successfully or False if an error occurred.</para>
    /// </returns>
    [FreeFunction("UnityReplayKitDiscard")]
    [NativeConditional("PLATFORM_IOS || PLATFORM_TVOS")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern bool Discard();

    public static bool ShowCameraPreviewAt(float posX, float posY)
    {
      return UnityEngine.Apple.ReplayKit.ReplayKit.ShowCameraPreviewAt(posX, posY, -1f, -1f);
    }

    /// <summary>
    ///   <para>Shows camera preview at coordinates posX and posY. The preview is width by height in size.</para>
    /// </summary>
    /// <param name="posX"></param>
    /// <param name="posY"></param>
    /// <param name="width"></param>
    /// <param name="height"></param>
    [FreeFunction("UnityReplayKitShowCameraPreviewAt")]
    [NativeConditional("PLATFORM_IOS || PLATFORM_TVOS")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern bool ShowCameraPreviewAt(
      float posX,
      float posY,
      float width,
      float height);

    /// <summary>
    ///   <para>Hide the camera preview view.</para>
    /// </summary>
    [NativeConditional("PLATFORM_IOS || PLATFORM_TVOS")]
    [FreeFunction("UnityReplayKitHideCameraPreview")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern void HideCameraPreview();

    /// <summary>
    ///   <para>Function called at the completion of broadcast startup.</para>
    /// </summary>
    /// <param name="hasStarted">This parameter will be true if the broadcast started successfully and false in the event of an error.</param>
    /// <param name="errorMessage">In the event of failure to start a broadcast, this parameter contains the associated error message.</param>
    public delegate void BroadcastStatusCallback(bool hasStarted, string errorMessage);
  }
}
